import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

export default defineConfig(
    () => {
        return {
            plugins: [vue()],
            resolve: {
                alias: {
                    '@': path.resolve(__dirname, 'src'), // 加这一段，@ 就代表 src 目录
                }
            },
            server: {
                port: 5173,
                open: true,
                proxy: {
                    '/api': {
                        target: 'http://localhost:8898/',
                        changeOrigin: true,
                        rewrite: (path) => path.replace(/^\/api/, '')
                    }
                }
            }
        }
    }
)
